const timer = {
    battcell: { start: "1736266227187", end: "1736328986064" },
    canspi: { start: "1736266227187", end: "1736328986064" },
    batttsnsr: { start: "1736266227187", end: "1736266227187" },
    signal: { start: "1736266227187", end: "1739516980300" }
};

const data = ["canspi", "signal"];

// 创建一个数组来存储结果
const result = [];

// 遍历 data 数组，从 timer 中提取对应的键值对
data.forEach(key => {
    if (timer.hasOwnProperty(key)) {
        result.push(timer[key]);
    }
});

// 提取所有 start 和 end 的时间戳
const starts = result.map(item => Number(item.start));
const ends = result.map(item => Number(item.end));

// 找出最早的 start 和最晚的 end
const earliestStart = Math.min(...starts);
const latestEnd = Math.max(...ends);

console.log("最早的 start 时间戳:", earliestStart); // 2025-01-08 00:10:27
console.log("最晚的 end 时间戳:", latestEnd); // 2025-02-14 15:09:40